package springframework.beans.factory.support;

import springframework.beans.PropertyValues;

public class ChildBeanDefinition extends AbstractBeanDefinition {
    private String parentName;

    public ChildBeanDefinition(String parentName, PropertyValues pvs) {
        super(pvs);
        this.parentName = parentName;
    }

    public String getParentName() {
        return this.parentName;
    }

//    public void validate() throws BeanDefinitionValidationException {
//        super.validate();
//        if (this.parentName == null) {
//            throw new BeanDefinitionValidationException("parentName must be set in ChildBeanDefinition");
//        }
//    }

    public boolean equals(Object obj) {
        if (!(obj instanceof ChildBeanDefinition)) {
            return false;
        } else {
            return super.equals(obj) && ((ChildBeanDefinition) obj).getParentName().equals(this.getParentName());
        }
    }

    public String toString() {
        return "Child bean definition with parent '" + this.getParentName() + "'";
    }
}

